package com.tanhua.server.controller;

import com.tanhua.server.service.MyCenterService;
import com.tanhua.server.vo.UserInfoVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RequestMapping("users")
@RestController
@Slf4j
public class MyCenterController {

    @Autowired
    private MyCenterService myCenterService;

    /**
     * 根据用户id查询用户信息
     *
     * @param userId 用户id，如果为空，表示查询当前登录人的信息
     * @return
     */
    @GetMapping
    public UserInfoVo queryUserInfoByUserId(@RequestParam(value = "userID", required = false) Long userId) {
        return this.myCenterService.queryUserInfoByUserId(userId);
    }

    /**
     * 是否喜欢
     *
     * @param userId
     * @return
     */
    @GetMapping("{userId}/alreadyLove")
    public Boolean isLike(@PathVariable("userId") Long userId){
        return this.myCenterService.isLike(userId);
    }
}
